package com.itheima02;

import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个整数:");
        int a = sc.nextInt();
        System.out.println("请输入第二个整数:");
        int b = sc.nextInt();
        try {
            method(a,b);
        } catch (ArithmeticException e) {
            System.out.println("第二个数不能为0!");
        }



    }
    public static void method(int a,int b) throws ArithmeticException{
        if(b==0){
            throw new ArithmeticException("第二个数不能为0!");
        }
        System.out.println(a/b);
    }
}
